<template>
  <div>
    <el-row :gutter="20" type="flex">
      <el-col :span="6">
        <el-input
          placeholder="请输入文章标题"
          v-model="listQueryIn.title"
          clearable
          size="small"
        >
        </el-input>
      </el-col>
      <el-col :span="12">
        <btn-search @click.native="refreshList()"></btn-search>
        <el-button type="primary" size="small" plain @click="handleBatchAudit"
          >批量审核</el-button
        >
      </el-col>
    </el-row>
  </div>
</template>
<script>
import { throttle } from 'lodash'
export default {
  data() {
    return {
      multipleSelection: [],
      listQueryIn: {
        title: '',
      },
    }
  },
  props: ['curColumn'],
  watch: {
    curColumn: {
      handler() {
        this.multipleSelection = []
      },
    },
  },
  mounted() {
    this.$bus.$on('changeSelectedData', (v) => {
      this.multipleSelection = v
    })
  },
  beforeDestroy() {
    this.$bus.$off('changeSelectedData')
  },
  methods: {
    handleInput: throttle(function () {
      this.refreshList()
    }, 2000),
    refreshList() {
      this.$bus.$emit('refreshNewsContentsList', this.listQueryIn)
    },

    //批量审核
    handleBatchAudit() {
      if (!this.multipleSelection.length) {
        this.warnMsg('请选择要审核的数据')
        return
      }
      this.$bus.$emit('articleAudit', this.multipleSelection)
    },
  },
}
</script>